package com.china.school.Pointcut的12种用法;

import com.china.school.pojo.User;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.EnableAspectJAutoProxy;


@Aspect
@ComponentScan({"com.china.school"}) //<context:component-scan base-package="xx"/>
@EnableAspectJAutoProxy
public class AnnotationTest {


    /**
      args(类型全限定名) 方法参数匹配
     */
    public static void main(String[] args) throws Exception {
        AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(AnnotationTest.class);
        User user = ctx.getBean(User.class);
        user.eat();
        user.doSomeThing("我要去西藏");

    }



     @Before("@annotation(com.china.school.MyAnno)")
    public void before(){
        System.out.println("------before---------");
    }






}
